package ch.trainingtest.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import ch.trainingtest.base.entity.BaseEntity;
import ch.trainingtest.common.NamedQueryConstants;


@Entity
@Table(name = "TTaskHistory")
@NamedQuery(name = NamedQueryConstants.TASKHISTORY_GET_ALL_HISTORY_BASE_ON_TASKID,
			query = "SELECT t FROM TaskHistory t WHERE t.task = :pTask")
public class TaskHistory extends BaseEntity {
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "ID")
	private int id;
	
	@Temporal(TemporalType.TIMESTAMP)
	private Date createdTime;
	
	@ManyToOne
	@JoinColumn(name = "taskID")
	private Task task;
	
	@Column(name = "action")
	private String action;
	
	@Column (name = "OldValue")
	private String from;
	
	@Column (name = "NewValue")
	private String to;
	
	@Column (name = "modifiedBy")
	private String modifiedBy;
	

	public String getModifiedBy() {
		return modifiedBy;
	}

	public void setModifiedBy(String modifiedBy) {
		this.modifiedBy = modifiedBy;
	}

	public TaskHistory() {
		super();
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Date getCreatedTime() {
		return createdTime;
	}

	public void setCreatedTime(Date createdTime) {
		this.createdTime = createdTime;
	}

	public Task getTask() {
		return task;
	}

	public void setTask(Task task) {
		this.task = task;
	}

	public String getAction() {
		return action;
	}

	public void setAction(String action) {
		this.action = action;
	}

	public String getFrom() {
		return from;
	}

	public void setFrom(String from) {
		this.from = from;
	}

	public String getTo() {
		return to;
	}

	public void setTo(String to) {
		this.to = to;
	}
	
	
	
}
